<?php

class Page extends BaseActiveRecord
{
    public function tableName()
    {
        return '{{pages}}';
    }

    public static function model($className=__CLASS__)
    {
        return parent::model($className);
    }

    public function rules() 
    {
        return array
        (
            array('page_title, page_name', 'required'),
            array('page_keywords, page_description, page_text', 'safe')
        );
    }
    
    public function attributeLabels()
    {
        return array
        (
            'page_name'  => 'Алиас',
            'page_title' => 'Заголовок',
            'page_keywords'  => 'Ключевые слова',
            'page_description'  => 'Описание',
            'page_text'  => 'Содержимое',
        );
    }
    
    public function getPageByAlias($sAlias)
    {
        return $this->findByAttributes(array
        (
            'page_name' => $sAlias
        ));
    }
}
